<!DOCTYPE html>
<!--suppress ThymeleafVariablesResolveInspection -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>场地信息列表</title>
    <link rel="stylesheet" th:href="@{../static/css/component.css}">
    <link rel="stylesheet" th:href="@{../static/css/admin.css}">
    <link rel="stylesheet" th:href="@{../static/css/font-awesome.min.css}">
    <script th:src="@{../static/js/JQuery2.1.4.js}"></script>
    <script th:src="@{../static/js/common.js}"></script>
    <script th:src="@{../static/js/vue.2.6.js}"></script>
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="rbody" id="detail">
    <div class="top">
        当前位置：后台<i class="fa fa-fw fa-angle-right"></i>场地信息列表
    </div>
    <div class="main">
        <div class="container-fluid">
            <div class="col-sm-12" id="right">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        搜索
                    </div>
                    <div class="panel-body">
                        <form role="form">
                            <div  class="form-inline">
                                <div class="form-group">
                                    <label>楼层</label>
                                    <select class="form-control" v-model="placestorey">
                                        <option></option>
                                        <option>一楼</option>
                                        <option>二楼</option>
                                        <option>三楼</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>场地类型</label>
                                    <select class="form-control" v-model="placetype">
                                        <option></option>
                                        <option>篮球场</option>
                                        <option>羽毛球场</option>
                                        <option>乒乓球场</option>
                                        <option>台球场</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <button type="button" class="btn btn-default" @click="researchPlaces(1)">开始筛选</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>

                <div class="table-responsive">
                    <a data-toggle="modal" data-target="#login" style="float: right;font-size: 20px"><i class="fa fa-plus" aria-hidden="true"></i>添加场地</a>
                    <table class="table table-striped ">
                        <thead>
                        <tr>
                            <th>场地编号</th>
                            <th>场地所属楼层</th>
                            <th>场地类型</th>
                            <th>场地负责人</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                            <tr v-for="(place,index) in places" :key="index">
                                <td>{{place.place_no}}</td>
                                <td>{{place.place_storey}}</td>
                                <td>{{place.place_type}}</td>
                                <td>{{place.place_leader}}</td>
                                <td>
                                    <div class="btn-group"><a @click="deletePlace(index)" style="font-size: 16px"><i class="fa fa-times" aria-hidden="true"></i>删除</a></div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <ul class="pagination">
                    <li v-if="show == '11'">
                        <a @click="getPlaces(page.prePage)">&laquo;</a>
                    </li>
                    <li v-if="show == '22'">
                        <a @click="researchPlaces(page.prePage)">&laquo;</a>
                    </li>
                    <li v-for="index in page.pages" :class="(page.pageNum == index) ? 'active' : '' ">
                        <a><span>{{index}}</span></a>
                    </li>
                    <li v-if="show == '11'">
                        <a @click="getPlaces(page.nextPage)">&raquo;</a>
                    </li>
                    <li v-if="show == '22'">
                        <a @click="researchPlaces(page.nextPage)">&raquo;</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <!-- 新增场地 -->
    <div id="login" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <button class="close" data-dismiss="modal">
                        <span>×</span>
                    </button>
                </div>
                <div class="modal-title">
                    <h1 class="text-center">新增场地</h1>
                </div>
                <div class="modal-body">
                    <form class="form-group" id="form1" action="/addPlace" method="post" @submit="checkPlaceNo">
                        <div class="form-group">
                            <label>场地编号</label>
                            <input id="placeno" v-model="place_no" name="place_no" class="form-control" type="text" pattern="[A-Za-z0-9]{3}" required>
                            <div class="invalid-feedback" id="no_err" style="color: red">{{message}}</div>
                        </div>
                        <div class="form-group">
                            <label>场地楼层</label>
                            <select class="form-control" name="place_storey">
                                <option>一楼</option>
                                <option>二楼</option>
                                <option>三楼</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label>场地类型</label>
                            <select class="form-control" name="place_type">
                                <option>篮球场</option>
                                <option>羽毛球场</option>
                                <option>乒乓球场</option>
                                <option>台球场</option>
                            </select>
                        </div>
                        <div class="text-right">
                            <button class="btn btn-primary" type="submit">确定</button>
                            <button class="btn btn-danger" data-dismiss="modal">取消</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script th:src="@{../static/js/placedetail.js}"></script>
</body>
</html>